package searchtab.preferences;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;

import searchtab.SearchTabActivator;

public class PreferencesManager {
    
    private static final IPreferenceStore PREFERENCE_STORE = SearchTabActivator.getDefault().getPreferenceStore();

    public static void setPreference(Preference preference, String value) {
        PREFERENCE_STORE.setValue(preference.getName(), value);
    }
    
    public static void setPreferenceDefault(Preference preference, String value) {
        PREFERENCE_STORE.setDefault(preference.getName(), value);
    }

    
    public static boolean getBoolean(Preference preference) {
        return PREFERENCE_STORE.getBoolean(preference.getName());
    }
    
    public static void addListener(IPropertyChangeListener listener) {
        PREFERENCE_STORE.addPropertyChangeListener(listener);
    }
    
    public static IPreferenceStore getPreferenceStore() {
        return PREFERENCE_STORE;
    }
}
